<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>题库 - MyOJ</title>
    <style>
        /*========= 设计变量（与首页保持一致） =========*/
        :root {
            --primary: #00c896;
            --primary-dark: #009e78;
            --bg-start: #0f172a;
            --bg-end: #1e293b;
            --glass: rgba(30, 41, 59, .55);
            --radius: 12px;
            --shadow: 0 8px 32px rgba(0, 0, 0, .37);
            --font-color: #e2e8f0;
            --font-dark: #94a3b8;
            --easy: #4ade80;
            --medium: #facc15;
            --hard: #f472b6;
        }

        /*========= 通用 reset =========*/
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body, html {
            width: 100%;
            min-height: 100%;
            font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            color: var(--font-color);
            background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
            background-attachment: fixed;
        }
        a {
            color: inherit;
            text-decoration: none;
        }

        /*========= 粒子背景（复用首页） =========*/
        #particles {
            position: fixed;
            inset: 0;
            z-index: -1;
        }

        /*========= 导航栏（与首页完全一致） =========*/
        header {
            position: sticky;
            top: 0;
            height: 64px;
            background: var(--glass);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border-bottom: 1px solid rgba(255, 255, 255, .05);
            z-index: 1000;
        }
        nav {
            max-width: 1200px;
            margin: 0 auto;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
        }
        .logo {
            font-size: 22px;
            font-weight: 700;
            letter-spacing: 1px;
            color: var(--primary);
        }
        .nav-links {
            display: flex;
            gap: 32px;
            align-items: center;
        }
        .nav-links a {
            color: var(--font-dark);
            font-size: 15px;
            transition: color .2s;
        }
        .nav-links a:hover {
            color: var(--primary);
        }
        .nav-btn {
            background: var(--primary);
            color: #fff;
            padding: 8px 18px;
            border-radius: var(--radius);
            font-weight: 600;
            transition: background .2s;
        }
        .nav-btn:hover {
            background: var(--primary-dark);
        }
        .hamburger {
            display: none;
            flex-direction: column;
            gap: 5px;
            cursor: pointer;
        }
        .hamburger span {
            width: 24px;
            height: 2px;
            background: var(--font-color);
            transition: .3s;
        }

        /*========= 主容器 =========*/
        main {
            max-width: 1000px;
            margin: 40px auto;
            padding: 0 24px;
        }
        h1 {
            font-size: 32px;
            margin-bottom: 32px;
            letter-spacing: .5px;
        }

        /*========= 桌面端表格 =========*/
        table {
            width: 100%;
            border-collapse: collapse;
            background: var(--glass);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid rgba(255, 255, 255, .06);
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow);
        }
        thead {
            background: rgba(0, 0, 0, .2);
        }
        th, td {
            padding: 16px 20px;
            text-align: left;
            font-size: 15px;
        }
        th {
            color: var(--font-dark);
            font-weight: 600;
        }
        tbody tr {
            transition: background .2s, transform .2s;
        }
        tbody tr:hover {
            background: rgba(255, 255, 255, .04);
            transform: translateY(-2px);
        }
        td a {
            color: var(--font-color);
            font-weight: 500;
        }
        td a:hover {
            color: var(--primary);
        }

        /* 难度标签 */
        .difficulty {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 13px;
            font-weight: 600;
            color: #000;
        }
        .difficulty.easy {
            background: var(--easy);
        }
        .difficulty.medium {
            background: var(--medium);
        }
        .difficulty.hard {
            background: var(--hard);
        }

        /*========= 移动端卡片式 =========*/
        @media (max-width: 768px) {
            table, thead, tbody, th, td, tr {
                display: block;
            }
            thead tr {
                display: none;
            }
            tbody tr {
                margin-bottom: 16px;
                padding: 16px 20px;
                border-radius: var(--radius);
                background: var(--glass);
                box-shadow: var(--shadow);
            }
            td {
                padding: 8px 0;
                display: flex;
                justify-content: space-between;
                align-items: center;
            }
            td::before {
                content: attr(data-label);
                color: var(--font-dark);
                font-weight: 600;
                margin-right: 12px;
            }
        }

        /*========= 页脚 =========*/
        footer {
            text-align: center;
            padding: 40px 24px 24px;
            font-size: 14px;
            color: var(--font-dark);
        }
    </style>
</head>
<body>
    <!-- 粒子背景 -->
    <canvas id="particles"></canvas>

    <!-- 导航栏（与首页一致） -->
    <header>
        <nav>
            <div class="logo">MyOJ</div>
            <div class="nav-links" id="navLinks">
                <a href="/">首页</a>
                <a href="/all_questions">题库</a>
                <a href="#">竞赛</a>
                <a href="#">讨论</a>
                <a href="#">求职</a>
                <a class="nav-btn" href="#">登录</a>
                <a class="nav-btn" href="#">注册</a>
            </div>
            <div class="hamburger" id="hamburger">
                <span></span><span></span><span></span>
            </div>
        </nav>
    </header>

    <!-- 主内容 -->
    <main>
        <h1>题库</h1>
        <table>
            <thead>
                <tr>
                    <th style="width:80px">编号</th>
                    <th>标题</th>
                    <th style="width:100px">难度</th>
                </tr>
            </thead>
            <tbody>
                {{#question_list}}
                <tr>
                    <td data-label="编号"><a href="/questions/{{number}}">{{number}}</a></td>
                    <td data-label="标题"><a href="/questions/{{number}}">{{title}}</a></td>
                    <td data-label="难度"><span class="difficulty easy">{{star}}</span></td>
                </tr>
                {{/question_list}}
            </tbody>
        </table>
    </main>

    <footer>
        © 2024 xxx大学 · 计算机科学与技术学院
    </footer>

    <script>
        /*========= 手机端菜单切换 =========*/
        const hamburger = document.getElementById('hamburger');
        const navLinks = document.getElementById('navLinks');
        hamburger.addEventListener('click', () => navLinks.classList.toggle('active'));

        /*========= 粒子背景（直接复用首页） =========*/
        const canvas = document.getElementById('particles');
        const ctx = canvas.getContext('2d');
        let particlesArray;
        function resize() {
            canvas.width = window.innerWidth;
            canvas.height = window.innerHeight;
        }
        window.addEventListener('resize', resize);
        resize();
        class Particle {
            constructor() {
                this.x = Math.random() * canvas.width;
                this.y = Math.random() * canvas.height;
                this.size = Math.random() * 1.5 + 1;
                this.speedX = (Math.random() - 0.5) * 0.4;
                this.speedY = (Math.random() - 0.5) * 0.4;
            }
            update() {
                this.x += this.speedX;
                this.y += this.speedY;
                if (this.x < 0 || this.x > canvas.width) this.speedX *= -1;
                if (this.y < 0 || this.y > canvas.height) this.speedY *= -1;
            }
            draw() {
                ctx.fillStyle = 'rgba(0, 200, 150, 0.55)';
                ctx.beginPath();
                ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
                ctx.fill();
            }
        }
        function init() {
            particlesArray = [];
            for (let i = 0; i < 70; i++) particlesArray.push(new Particle());
        }
        init();
        function animate() {
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            for (let p of particlesArray) {
                p.update();
                p.draw();
            }
            requestAnimationFrame(animate);
        }
        animate();
    </script>
</body>
</html>